import matplotlib.pyplot as plt
import numpy as np

n_min = -10
n_max = 10
n = np.arange(n_min, n_max+1, 1)

# 定义函数sin(x)
x = 5 * np.sin(0.4 * np.pi * n)

plt.rcParams['font.sans-serif'] = ['SimHei']  # 加上这一句就能在图表中显示中文
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号

plt.stem(n, x)

plt.show()
